import http from './index'

export default {


  get
  //登录请求
  login({username, password}) {
    return http.post('/login',{
      username,
      password
    })
  },
  //用户数据请求
  getUsers({ pagenum, pagesize, query }) {
    if (query) {
      return http.get(`/users?pagenum=${pagenum}&pagesize=${pagesize}&query=${query}`)
    } else {
      return http.get(`/users?pagenum=${pagenum}&pagesize=${pagesize}`)
    }
  },
  //左边导航栏请求
  getmenus(){
    return http.get('/menus')
},
  //角色管理请求
  getroles(){
    return http.get('/roles')
  },
  //添加用户请求
  getaddusers({username,password,email,mobile}){
    return http.post('/users',{
      username,
      password,
      email,
      mobile
    })
  },
  //用户状态请求
  getstate({uId,type}){
    return http.put(`users/${uId}/state/${type}`)
  },
  //c查询id
  getidid({id}){
    return http.get(`users/${id}`)
  },
   //点击删除
   getdelete({id}){
    return http.delete(`users/${id}`)
  },
  //分配用户角色
  getidrole({id,rid}){
    return http.put(`users/${id}/role`,{
      rid
    })
  },
  //分配用户角色
  getreports(){
    return http.get('reports/type/1')
  },
  
}